package com.gagakuai.bpm.domian.events;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;

import java.util.Date;

/*
 * @program: rep_server
 * @description: 系统关闭事件
 * @author: houhong
 * @create: 2021-12-02 17:05
 */
@Component
public class SystemCloedListener implements ApplicationListener<ContextClosedEvent> {

    private Logger logger = LoggerFactory.getLogger(SystemStartUpListener.class);

    @Override
    public void onApplicationEvent(ContextClosedEvent event) {

        String pattern = "yyyy-MM-dd HH:mm:ss";
        String startUpTime = DateFormatUtils.format(new Date(), pattern);

        logger.info("维修资源管理系统已经关闭！关闭时间:{}", startUpTime);


    }


}